package bud.mobile.service;

import java.util.List;

import bud.mobile.dao.IMobileMemberDao;
import bud.vo.FriendDTO;
import bud.vo.MemberDTO;
import bud.vo.ShopDTO;

public class MobileMemberServiceImpl implements IMobileMemberService{

	private IMobileMemberDao dao;
	
	public IMobileMemberDao getDao() {
		return dao;
	}
	public void setDao(IMobileMemberDao dao) {
		this.dao = dao;
	}

	@Override
	public MemberResult insertMember(MemberDTO member) {
		String mem_email = member.getMem_email();
		MemberDTO tempMember = dao.getMemberByEmail(mem_email);
		if(tempMember == null){
			int result = dao.insertMember(member);
			if(result >= 1){
				return MemberResult.OK;
			} else {
				return MemberResult.Failed;
			}
		} else {
			return MemberResult.EmailDuplicated;
		}
	}

	@Override
	public MemberResult deleteMember(MemberDTO member) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public MemberResult updateMember(MemberDTO member) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public MemberDTO getMember(Integer mem_no) {
		return dao.getMember(mem_no);
	}
	@Override
	public MemberDTO getMemberByEmail(String mem_email) {
		return dao.getMemberByEmail(mem_email);
	}
	@Override
	public ShopDTO getShop(Integer sh_no) {
		return dao.getShop(sh_no);
	}
	@Override
	public List<ShopDTO> getShopList() {
		return dao.getShopList();
	}
	
}
